package com.szh.lenovo0520.IntentService;

import androidx.appcompat.app.AppCompatActivity;

import android.app.IntentService;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.szh.lenovo0520.R;

public class IntentServicectivity extends AppCompatActivity {
    private Button btn01;
    private Button btn02;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_intent_servicectivity);
        initView();
    }

    private void initView() {
        btn01 = (Button) findViewById(R.id.btn01);
        btn02 = (Button) findViewById(R.id.btn02);
        btn01.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(IntentServicectivity.this, MyIntentService.class);
                intent.putExtra("task1","hello");
                startService(intent);
            }
        });
        btn02.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(IntentServicectivity.this, MyIntentService.class);
                intent.putExtra("task2","lenovo");
                startService(intent);
            }
        });
    }

}
